package com.wlz.jvm;

import java.util.ArrayList;
import java.util.List;
import java.util.UUID;

/**
 *  OOM
 * @author wlz
 * @date 2022-03-21  9:22 下午
 */
public class OOMTest {

    // JVM设置
    // -Xms10M -Xmx10M -XX:+PrintGCDetails -XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath=/Users/wlz/Desktop/jvm.dump
    public static void main(String[] args) {

        List<Object> list = new ArrayList<>();
        int i = 0;
        int j = 0;
        while (true) {
//            System.out.println("aaaaaa");
            list.add(new User(i++, UUID.randomUUID().toString()));
            new User(j--, UUID.randomUUID().toString());
        }
    }
}
